home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / include / sun4.md / RCS / varargs.h,v < prev    next >
Encoding:
Text File  |  1991-02-02  |  3.2 KB  |  154 lines

  1. head     1.4;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.4
  10. date     91.02.01.16.24.28;  author rab;  state Exp;
  11. branches ;
  12. next     1.3;
  13.  
  14. 1.3
  15. date     89.07.14.09.29.20;  author rab;  state Exp;
  16. branches ;
  17. next     1.2;
  18.  
  19. 1.2
  20. date     89.02.24.22.01.03;  author mgbaker;  state Exp;
  21. branches ;
  22. next     1.1;
  23.  
  24. 1.1
  25. date     89.01.23.12.49.03;  author mendel;  state Exp;
  26. branches ;
  27. next     ;
  28.  
  29.  
  30. desc
  31. @Varargs for the sun4.
  32. @
  33.  
  34.  
  35. 1.4
  36. log
  37. @Mary checking this in for Bob.
  38. @
  39. text
  40. @/*
  41.  * varargs.h --
  42.  *
  43.  *    Macros for handling variable-length argument lists.
  44.  *
  45.  * Copyright 1988 Regents of the University of California
  46.  * Permission to use, copy, modify, and distribute this
  47.  * software and its documentation for any purpose and without
  48.  * fee is hereby granted, provided that the above copyright
  49.  * notice appear in all copies.  The University of California
  50.  * makes no representations about the suitability of this
  51.  * software for any purpose.  It is provided "as is" without
  52.  * express or implied warranty.
  53.  *
  54.  * $Header: /sprite/src/lib/include/sun4.md/RCS/varargs.h,v 1.3 89/07/14 09:29:20 rab Exp Locker: rab $ SPRITE (Berkeley)
  55.  */
  56.  
  57. #ifndef _VARARGS
  58. #define _VARARGS
  59.  
  60. #ifndef _VA_LIST
  61. #define _VA_LIST
  62. typedef char *va_list;
  63. #endif
  64.  
  65. /*
  66.  * An argument of list of __builtin_va_alist causes the sun4 compiler
  67.  * to store all the input registers, %i0 to %i5, in the stack frame
  68.  * so the var_arg() macro will be able to reference them in memory.
  69.  */
  70. #define va_alist __builtin_va_alist
  71.  
  72. #define va_dcl int __builtin_va_alist;
  73.  
  74. #define va_start(AP) (__builtin_saveregs(), (AP) = (char *)&__builtin_va_alist)
  75.  
  76. #define __va_rounded_size(TYPE)  \
  77.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  78.  
  79. #define va_arg(AP, TYPE)                        \
  80.  ((AP) += __va_rounded_size (TYPE),                    \
  81.   *((TYPE *) ((AP) - __va_rounded_size (TYPE))))
  82.  
  83.  
  84. /*  #define va_arg(list, type)  ((type *)(list += sizeof(type)))[-1]  */
  85.  
  86. #define va_end(list)
  87.  
  88. #endif /* _VARARGS */
  89. @
  90.  
  91.  
  92. 1.3
  93. log
  94. @*** empty log message ***
  95. @
  96. text
  97. @d15 1
  98. a15 1
  99.  * $Header: /sprite/src/lib/include/sun4.md/RCS/varargs.h,v 1.2 89/02/24 22:01:03 mgbaker Exp Locker: rab $ SPRITE (Berkeley)
  100. d21 2
  101. d24 1
  102. @
  103.  
  104.  
  105. 1.2
  106. log
  107. @Fourteenth Kernel for sun4.  The mem module was added, and its print
  108. routine requires varargs.  But this header file wouldn't compile, so I
  109. fixed it.  I hope I did the right thing.
  110. @
  111. text
  112. @d15 1
  113. a15 1
  114.  * $Header: /sprite/src/lib/include/sun4.md/RCS/varargs.h,v 1.1 89/01/23 12:49:03 mendel Exp Locker: mgbaker $ SPRITE (Berkeley)
  115. d21 1
  116. a21 5
  117. typedef struct {
  118.     char *vl_current;            /* Pointer to last arg returned from
  119.                      * list. */
  120.     char *vl_next;            /* Pointer to next arg to return. */
  121. } va_list;
  122. d32 1
  123. a32 2
  124. #define va_start(list) \
  125.     (list).vl_current = (list).vl_next = (char *) &__builtin_va_alist;
  126. d34 2
  127. a35 4
  128. #define va_arg(list, type)            \
  129.     ((list).vl_current = (list).vl_next,    \
  130.     (list).vl_next += sizeof(type),        \
  131.      *((type *) (list).vl_current))
  132. d37 7
  133. d46 1
  134. a46 1
  135. #endif _VARARGS
  136. @
  137.  
  138.  
  139. 1.1
  140. log
  141. @Initial revision
  142. @
  143. text
  144. @d15 1
  145. a15 1
  146.  * $Header: varargs.h,v 1.1 88/06/21 09:37:01 ouster Exp $ SPRITE (Berkeley)
  147. d34 1
  148. a34 1
  149. #define va_dcl int _va_args;
  150. d37 1
  151. a37 1
  152.     (list).vl_current = (list).vl_next = (char *) &_va_args;
  153. @
  154.